from api.vip import VipAPI
import unittest
import json

class TestVipAPI(unittest.TestCase):
    def setUp(self):
        self.vipAPI = VipAPI()

    def test01_getTaglibByAge(self):
        #处理多层字典，把python对象转换成json对象的一个过程，生成的是字符串
        params=json.dumps({"appDevice": {"clientversion": "7.24", "birthday": "2020-11-19 11:26:56", "yxyskin": "0",
                                    "prematureOpen": "0", "deviceuuid": "aeb2d6be6ed24fb58a05e28af005ac00",
                                    "userID": "0", "deviceno": "A00251B4-8972-4F77-A714-440E7B4FCC9E",
                                    "channel": "official", "t": "1634267047274", "appcode": "20000", "abType": "26",
                                    "loginType": "5", "sign": "b297c8e3e12e837e91e39938d22c44ca",
                                    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImlzc3VlciI6bnVsbCwiaWF0VGltZSI6MTYzNDI2NjAyNzkxMn0.eyJpbXBsaWNpdExvZ2luIjoiZmFsc2UiLCJhY2NvdW50SWQiOiI1MzYxNDQ1MzY5NTA0NTYzMjAiLCJsb2dpblR5cGUiOiJ0b3VyaXN0IiwibG9nZ2VyIjoib3JnLmFwYWNoZS5sb2dnaW5nLnNsZjRqLkxvZzRqTG9nZ2VyQDZmMGJmM2RhIiwiYXBwQ29kZSI6IllVWFkiLCJkZXZpY2VubyI6IkEwMDI1MUI0LTg5NzItNEY3Ny1BNzE0LTQ0MEU3QjRGQ0M5RSIsImV4cCI6MTYzNDI4NzYyNywiaWF0IjoxNjM0MjY2MDIyLCJqdGkiOiIwIiwibWVtYmVySWQiOiJudWxsIn0.TMOfyk_H4BdSCIXXYfKu9QMw-JkRsWhyvxt82sEaMQw",
                                    "osversion": "14.2", "ostype": "1", "hgestation": "0",
                                    "expectedDate": "2020-11-19 11:26:56", "accountId": "536144536950456320",
                                    "idfa": "A00251B4-8972-4F77-A714-440E7B4FCC9E"}, "lastNodeTagId": "-1",
                      "traceLogId": "c85aa6dd1a8c4b66ae1e03230d36d151", "childId": "536144553450958848",
                      "firstNodeTagId": "-1"})
        data = {
            "body":params
        }
        response = self.vipAPI.getTaglibByAge(requrest_data=data)
        print(response.json())

    def test02_getTagContentAPI(self):
        params=json.dumps({"appDevice":{"clientversion":"7.24","birthday":"2020-11-19 11:26:56","yxyskin":"0","prematureOpen":"0","deviceuuid":"aeb2d6be6ed24fb58a05e28af005ac00","userID":"0","deviceno":"A00251B4-8972-4F77-A714-440E7B4FCC9E","channel":"official","t":"1634267047274","appcode":"20000","abType":"26","loginType":"5","sign":"b297c8e3e12e837e91e39938d22c44ca","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImlzc3VlciI6bnVsbCwiaWF0VGltZSI6MTYzNDI2NjAyNzkxMn0.eyJpbXBsaWNpdExvZ2luIjoiZmFsc2UiLCJhY2NvdW50SWQiOiI1MzYxNDQ1MzY5NTA0NTYzMjAiLCJsb2dpblR5cGUiOiJ0b3VyaXN0IiwibG9nZ2VyIjoib3JnLmFwYWNoZS5sb2dnaW5nLnNsZjRqLkxvZzRqTG9nZ2VyQDZmMGJmM2RhIiwiYXBwQ29kZSI6IllVWFkiLCJkZXZpY2VubyI6IkEwMDI1MUI0LTg5NzItNEY3Ny1BNzE0LTQ0MEU3QjRGQ0M5RSIsImV4cCI6MTYzNDI4NzYyNywiaWF0IjoxNjM0MjY2MDIyLCJqdGkiOiIwIiwibWVtYmVySWQiOiJudWxsIn0.TMOfyk_H4BdSCIXXYfKu9QMw-JkRsWhyvxt82sEaMQw","osversion":"14.2","ostype":"1","hgestation":"0","expectedDate":"2020-11-19 11:26:56","accountId":"536144536950456320","idfa":"A00251B4-8972-4F77-A714-440E7B4FCC9E"},"lastNodeTagId":"-1","traceLogId":"c85aa6dd1a8c4b66ae1e03230d36d151","childId":"536144553450958848","firstNodeTagId":"-1"})
        data={
            "body":params
        }
        response=self.vipAPI.getTagContent(requrest_data=data)
        print(response.json())
